<!DOCTYPE html>
<html lang="en">

    <head>
        <link rel="stylesheet" type="text/css" src="https://www.layuicdn.com/layui/css/layui.css">
        <script src="https://www.layuicdn.com/layui/layui.js"></script>
        <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    </head>

    <body>

        <input type="text" name="" id="memberName">

        <input type="text" name="" id="subName" value="我是你儿子">
        <input type="button" value="submit" id="submit"></input:>
    </body>
    <script>
        layui.use(['form', 'element', 'layer'], function() {
            var form = layui.form;
            var element = layui.element;
            var layer = layui.layer;
            //var $ = layer.jquery;


            $("#submit").click(function() {
                // $("#memberName").val("我是你儿子");
                //把数据传回父窗口
                console.log("parent");
                console.log(parent);
                let data = $("#subName").val();
               // window.parent.$("#text1").val(data);
                parent.getSubData('我是你儿子'); //这是父页面函数
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭        

            })




        });
    </script>

</html>
